<?php 
include_once("conexion.class.php");

class Info{
 //constructor	
 	var $con;
 	function Info(){
 		$this->con=new DBManager;
 	}

	function insertar($campos){
		if($this->con->conectar()==true){			
			return mysql_query("INSERT INTO 
								  `info_sms`
								(
								  `mensaje1`,
								  `mensaje2`,
								  `keyword_id`
								) 
								(
								SELECT 
								  '".$campos[0]."', '".$campos[1]."',  `id`
								FROM 
								  `keyword` where `id_usuario` = ".$campos[2]." order by id desc
								);");

		}
	}
	
	function actualizar_info_sms($campos,$id){
			

		if($this->con->conectar()==true){
			//print_r($campos);
			return mysql_query("UPDATE 
								  `info_sms`  
								SET 
								  `mensaje1` = '".$campo[0]."',
								  `mensaje2` = '".$campo[1]."'
								WHERE 
								  `keyword_id` =  ".$id);
		}
	}
	
	
	function mostrar_keyword($id){
		if($this->con->conectar()==true){
			return mysql_query("SELECT * FROM keyword WHERE id=".$id);
		}
	}

	function mostrar_keywords(){
		if($this->con->conectar()==true){
			return mysql_query("SELECT * FROM keyword");
		}
	}

	function eliminar($id){
		if($this->con->conectar()==true){
			return mysql_query("DELETE FROM keyword WHERE id=".$id);
		}
	}
}
?>